
MSNWidget = {};

MSNWidget.Page = function()
{

}

MSNWidget.Page.prototype =
{
  handleLoad: function(control, userContext, rootElement)
  {
		this.control = control;
		this.rootElement = rootElement;
		
		MSNWidget.root = rootElement;
		
		this.ButtonsCanvas = rootElement.findName("ButtonsCat");
		
		//Den Canvas fr die Feed-Eintrge auf die maximale Breite bringen
		updateCanvas(rootElement);
	    
    addEvents(rootElement.findName("Btn_MSN"));
    addEvents(rootElement.findName("Btn_More"));
    
    this.SearchBar = new SearchBar(rootElement.findName("SearchBar_Bg"));
    this.rootElement.addEventListener("MouseLeftButtonDown", this.SearchBar.looseFocus);
    
    rootElement.findName("subcat_right_btn").addEventListener("MouseEnter", switchSubCats);
    rootElement.findName("subcat_left_btn").addEventListener("MouseEnter", switchSubCats);
    
    rootElement.findName("subcat_right_btn").addEventListener("MouseLeave", stopSubCats);
    rootElement.findName("subcat_left_btn").addEventListener("MouseLeave", stopSubCats);
    
    rootElement.findName("SearchBar_Options").addEventListener("MouseLeftButtonDown", showOptions);
    rootElement.findName("SearchBar_Download").addEventListener("MouseLeftButtonDown", download);
       
    //Initial mit Top-Nachrichten anzeigen
    clearNews(rootElement);
    var subcat = 10;
    buildSubcats(rootElement, subcat);
    getNews(rootElement, subcat);
    
    //Noch einmal das Design berprfen
    updateCanvas(rootElement);     
	}
}
